<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li >当个删除</li>
                <li class="layui-this">批量删除</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item">
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label for="" class="layui-form-label">分机号</label>
                            <div class="layui-input-inline">
                                <input type="number" name="extension" placeholder="请输入分机号" lay-verify="required|number" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="type" value="1">
                                <button class="layui-btn" lay-submit="" lay-filter="submitForm">确认</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item layui-show">
                    <form class="layui-form">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">起始分机号</label>
                                    <div class="layui-input-inline" style="width: 120px;">
                                        <input type="number" name="extension_start" placeholder="开始分机号" lay-verify="required|number" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid">-</div>
                                    <div class="layui-input-inline" style="width: 120px;">
                                        <input type="number" name="extension_end" placeholder="结束分机号" lay-verify="required|number" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="type" value="2">
                                    <button class="layui-btn" lay-submit="" lay-filter="submitForm">确认</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </form>
                </div>
            </div>
        </div>
    </div>
</div>


<?php
$url = yii\helpers\Url::to(['destroy']);

$js = <<<JS
    layui.use(['form','element','table', 'layer'],function() {
        var form = layui.form;  
        var element = layui.element;  
        var table = layui.table;  
        var layer = layui.layer;  
        
        //监听表单提交
        form.on('submit(submitForm)',function(data) {
            var where = data.field
            var index = layer.load()
            $.post("{$url}",where,function(res) {
                layer.close(index)
                layer.msg(res.msg,{},function() {
                    if (res.code==0){
                        location.reload();
                    }   
                })   
            })
            return false
        })
        
        
    });
JS;
$this->registerJs($js);
